package com.xbongbong.saas.model.impl;

import com.xbongbong.paas.toolbox.util.CollectionsUtil;
import com.xbongbong.paas.toolbox.util.DateUtil;
import com.xbongbong.saas.domain.dao.CoolAppCardDataDao;
import com.xbongbong.saas.domain.entity.CoolAppCardDataEntity;
import com.xbongbong.saas.model.CoolAppCardDataModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/***
 *
 * @author hongxiao
 * @date 2022-06-09 10:23
 * @since
 * @version
 */
@Service("coolAppCardDataModel")
public class CoolAppCardDataModelImpl implements CoolAppCardDataModel {
    @Resource
    private CoolAppCardDataDao coolAppCardDataDao;

    @Override
    public Integer insert(CoolAppCardDataEntity entity) {
        return coolAppCardDataDao.insert(entity);
    }

    @Override
    public void insertBatch(List<CoolAppCardDataEntity> list) {
        coolAppCardDataDao.insertBatch(list);
    }

    @Override
    public List<CoolAppCardDataEntity> findEntitys(Map<String, Object> param) {
        return coolAppCardDataDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return coolAppCardDataDao.getEntitysCount(param);
    }

    @Override
    public Integer update(CoolAppCardDataEntity entity) {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return coolAppCardDataDao.update(entity);
    }

    @Override
    public Integer updateBatch(List<CoolAppCardDataEntity> list, String corpid) {
        if (CollectionsUtil.isEmpty(list)) {
            return 0;
        }
        return coolAppCardDataDao.updateBatch(list, corpid);
    }

    @Override
    public CoolAppCardDataEntity getByKey(Long key, String corpid) {
        return coolAppCardDataDao.getByKey(key, corpid);
    }

    @Override
    public List<CoolAppCardDataEntity> findEntitysWithoutSub(Map<String, Object> param) {
        return coolAppCardDataDao.findEntitys(param);
    }

    @Override
    public CoolAppCardDataEntity getByCardBizId(String corpid, String cardBizId) {
        return coolAppCardDataDao.getByCardBizId(corpid, cardBizId);
    }
}
